FROM openjdk:17

# 指定启动环境
ENV ACTIVE_PROFILE=local

#指定加密盐值
ENV JASYPT_PASS=a

# Java MEM Options, 可以在部署时设置修改
ENV JAVA_MEM_OPTIONS="-Xms512m -Xmx1g -XX:-UseGCOverheadLimit"

# Java Start Default Options
ENV JAVA_DFLT_OPTS="-server -XX:+PrintCommandLineFlags -Duser.timezone=GMT+08 -Djava.security.egd=file:/dev/./urandom -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=512m -XX:-UseParallelGC -XX:NewRatio=1 -XX:SurvivorRatio=8"

# Add jar file
ADD target/*.jar /app.jar

# cp time zone
RUN \cp -f /usr/share/zoneinfo/GMT /etc/localtime

# Expose service port
EXPOSE 8080

ENTRYPOINT ["sh","-c","exec java $JAVA_DFLT_OPTS $JAVA_MEM_OPTIONS -Dspring.profiles.active=${ACTIVE_PROFILE}  -Djasypt.encryptor.password=${JASYPT_PASS} -jar /app.jar"]